﻿/*
 * (c) Stefan Bojarovski 2010
 * */
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ASTBuilder
{
    class FactorNode //: NodesCollection, IArithmeticNode
    {
        private LexemeType lexType;
        private TokenType factorType;
        private ITreeNode firstOperand;
        private ITreeNode secondOperand;
        private bool UMinus;

        public FactorNode(LexemeType someLType, TokenType someFType, ITreeNode firstOp, ITreeNode secondOp)
        {
            lexType = someLType;
            factorType = someFType;
            firstOperand = firstOp;
            secondOperand = secondOp;
        }
        public LexemeType getLexemeType()
        {
            return lexType;
        }
        public void setNegative()
        {
            UMinus = true;
        }
        public void printNode(String parentLevel, StreamWriter someStream)
        {
            someStream.WriteLine(parentLevel + " " + "Factor: ");
            someStream.WriteLine(parentLevel + " " + "FirstOperand: ");
            firstOperand.printNode(parentLevel + " ", someStream);
            if (factorType != TokenType.UNKNOWN)
            {
                someStream.WriteLine(parentLevel + " " + factorType.ToString());
            }
            /*
            if (secondOperand != null)
            {
                someStream.WriteLine(parentLevel + " " + "SecondOperand: ");
                secondOperand.printNode(parentLevel + " ", someStream);
            }*/
        }
        /*public List<Command> evalNode(out Direction next, out Dictionary<String, object> Environment)
        {
            Command first = firstOperand.evalNode(next, Environment)[0];
            //Command second;
            Command result;
            object Value;

            switch(factorType)
            {
                case TokenType.*/
    }
}
